/* F:\ICADDEV\PRJ\ICAD\PATHS.H
 * Copyright (C) 1997-1999 DIMINE Co.LTD. All rights reserved.
 * 
 * Abstract
 * 
 * General support for filepath operations
 * 
 */ 

#ifndef _PATHS_H__
#define _PATHS_H__

#include "atlstr.h"

#define CSIDL_DESKTOP                   0x0000        // <desktop>
#define CSIDL_INTERNET                  0x0001        // Internet Explorer (icon on desktop)
#define CSIDL_PROGRAMS                  0x0002        // Start Menu\Programs
#define CSIDL_CONTROLS                  0x0003        // My Computer\Control Panel
#define CSIDL_PRINTERS                  0x0004        // My Computer\Printers
#define CSIDL_PERSONAL                  0x0005        // My Documents
#define CSIDL_FAVORITES                 0x0006        // <user name>\Favorites
#define CSIDL_STARTUP                   0x0007        // Start Menu\Programs\Startup
#define CSIDL_RECENT                    0x0008        // <user name>\Recent
#define CSIDL_SENDTO                    0x0009        // <user name>\SendTo
#define CSIDL_BITBUCKET                 0x000a        // <desktop>\Recycle Bin
#define CSIDL_STARTMENU                 0x000b        // <user name>\Start Menu

	// utility class for parsing file strings
class  FileString : public CString
	{
public:
				FileString() {}
				FileString( const CString& string) : CString( string) {}

	CString		GetDrive() const;
	CString		GetDirectory() const;
	CString		GetFilename() const;
	CString		GetExtension() const;

static FileString	ModuleFile();
static FileString	ModulePath();
	};


	// class to process files found on path
class   AbstractFileProcessor
	{
public:
	virtual void ProcessFile( LPCTSTR, WIN32_FIND_DATA&) = 0;
	};


class   FilePath : public CString
	{
public:
	FilePath() {};
	FilePath( LPCTSTR string) : CString( string) {}

	int  FindFiles( AbstractFileProcessor&, LPCTSTR pattern);
	};


class SystemPaths
{
public:
	SystemPaths();

	bool LoadFromRegistry();
	bool SaveToRegistry();

	//*** System Paths from options dialog
	CString m_drawingPath;
	CString m_fontPath;
	CString m_helpPath;
	CString m_xrefPath;
	CString m_menuPath;
	CString m_hatchPatPath;

protected:
	LONG LoadKey(HKEY hKey, CString valueName, CString &value);
	void SaveKey(HKEY hKey, CString valueName, CString value);
};


 bool	SearchDrawingFile( LPCTSTR, TCHAR *);
 bool	SearchFontFile( LPCTSTR, TCHAR *);
 bool	SearchHatchFile( LPCTSTR, TCHAR *);
 bool	SearchHelpFile( LPCTSTR which, TCHAR *);
 bool	SearchMenuFile( LPCTSTR, TCHAR *);
 bool	SearchXrefFile( LPCTSTR, TCHAR *);
 void	CommandRefHelp( HWND window, DWORD context);
 bool	SearchHelpFile( LPCTSTR which, TCHAR *result);


#endif

